package 牛客.动态规划;

public class BM63跳台阶 {
    public int jumpFloor(int target) {
        //动态规划
        if (target<=1) {
            return target;
        }
        int[] dp=new int[target+1];
        //dp[0]=0; 本题对于0的讨论无意义
        dp[1]=1;
        dp[2]=2;
        for (int i = 3; i <dp.length; i++) {
            dp[i]=dp[i-1]+dp[i-2];
        }
        return dp[target];

    }

    public int jumpFloor1(int target) {
        if (target==1) {
            return 1;
        }
        if (target==2) {
            return 2;
        }
         return jumpFloor(target-1)+jumpFloor(target-2);

    }
}
